package com.wlyuan.open.constants;

import lombok.Getter;

/**
 * 计费方式
 *
 * @author lijing
 */
@Getter
public enum BillingMode {

    WEIGHT("重量", 1),
    VOLUME("体积", 2),
    QUANTITY("数量", 3),
    ;

    private final String name;
    private final Integer value;

    BillingMode(String name, Integer value) {
        this.value = value;
        this.name = name;
    }


    public static BillingMode fromValue(Integer value) {
        if (WEIGHT.value.equals(value)) {
            return WEIGHT;
        } else if (VOLUME.value.equals(value)) {
            return VOLUME;
        } else if (QUANTITY.value.equals(value)) {
            return QUANTITY;
        }
        return null;
    }
}



